import base64
import io
import logging
import os.path
import re
import sys
import time

from datetime import datetime, timedelta
from dateutil.relativedelta import relativedelta

import pytz
from lxml import etree, builder

import odoo
from . import assertion_report, pycompat
from .config import config
from .misc import file_open, unquote, ustr, SKIPPED_ELEMENT_TYPES
from .translate import _
from odoo import SUPERUSER_ID

_logger = logging.getLogger(__name__)

from .safe_eval import safe_eval as s_eval
safe_eval = lambda expr, ctx={}: s_eval(expr, ctx, nocopy=True)

class ParseError(Exception):
    def __init__(self, msg, text, filename, lineno):
        pass

    def __str__(self):
        pass

class RecordDictWrapper(dict):
    def __init__(self, record):
        pass
    def __getitem__(self, key):
        pass

def _get_idref(self, env, model_str, idref):
    pass

def _fix_multiple_roots(node):
    pass

def _eval_xml(self, node, env):
    pass

def str2bool(value):
    pass

class xml_import(object):
    @staticmethod
    def nodeattr2bool(node, attr, default=False):
        pass

    def isnoupdate(self, data_node=None):
        pass

    def get_context(self, data_node, node, eval_dict):
        pass

    def get_uid(self, data_node, node):
        pass

    def make_xml_id(self, xml_id):
        pass

    def _test_xml_id(self, xml_id):
        pass

    def _tag_delete(self, rec, data_node=None, mode=None):
        pass

    def _tag_report(self, rec, data_node=None, mode=None):
        pass

    def _tag_function(self, rec, data_node=None, mode=None):
        pass

    def _tag_act_window(self, rec, data_node=None, mode=None):
        pass

    def _tag_menuitem(self, rec, data_node=None, mode=None):
        pass

    def _assert_equals(self, f1, f2, prec=4):
        pass

    def _tag_assert(self, rec, data_node=None, mode=None):
        pass

    def _tag_record(self, rec, data_node=None, mode=None):
        pass

    def _tag_template(self, el, data_node=None, mode=None):
        pass

    def id_get(self, id_str, raise_if_not_found=True):
        pass

    def model_id_get(self, id_str, raise_if_not_found=True):
        pass

    def parse(self, de, mode=None):
        pass

    def __init__(self, cr, module, idref, mode, report=None, noupdate=False, xml_filename=None):
        pass

def convert_file(cr, module, filename, idref, mode='update', noupdate=False, kind=None, report=None, pathname=None):
    pass

def convert_sql_import(cr, fp):
    pass

def convert_csv_import(cr, module, fname, csvcontent, idref=None, mode='init',
        noupdate=False):
            pass

def convert_xml_import(cr, module, xmlfile, idref=None, mode='init', noupdate=False, report=None):
    pass
